import Defines, random

class Troop:
	def __init__(self, name_, troopType_, level_):
		self.name = name_
		self.level = level_
		self.injured = False
		self.xp = 0
		self.troopType = troopType_

		# sets stats based on troopType
		if self.troopType == Defines.TroopType.SOLDIER:
			self.health = (100 * self.level) + random.randint(-5,5)
			self.maxHealth = self.health
			self.armour = 1
			self.damage = (10 + self.level) + random.randint(-2,2)
			self.evasion = (5) + random.randint(-1,1)
			self.accuracy = (90) + random.randint(-15,0)
		elif self.troopType == Defines.TroopType.SNIPER:
			self.health = (80 * self.level) + random.randint(-5,5)
			self.maxHealth = self.health
			self.armour = 0
			self.damage = (20 + self.level) + random.randint(-2,2)
			self.evasion = (50) + random.randint(-5,5)
			self.accuracy = (50) + random.randint(-5,5)
		elif self.troopType == Defines.TroopType.MEDIC:
			self.health = (100 * self.level) + random.randint(-5,5)
			self.maxHealth = self.health
			self.armour = 1
			self.damage = (5 + self.level) + random.randint(-1,1)
			self.evasion = (5) + random.randint(-1,1)
			self.accuracy = (90) + random.randint(-15,0)
		elif self.troopType == Defines.TroopType.SCOUT:
			self.health = (100 * self.level) + random.randint(-5,5)
			self.maxHealth = self.health
			self.armour = 1
			self.damage = (8 + self.level) + random.randint(-1,1)
			self.evasion = (25) + random.randint(-4,4)
			self.accuracy = 90 + random.randint(-10,0)
		elif self.troopType == Defines.TroopType.MELEE:
			self.health = (110 * self.level) + random.randint(-5,5)
			self.maxHealth = self.health
			self.armour = 1
			self.damage = (15 + self.level) + random.randint(-2,2)
			self.evasion = (0) + random.randint(0,2)
			self.accuracy = 100 + random.randint(-5,-1)
		elif self.troopType == Defines.TroopType.HEAVY:
			self.health = (120 * self.level) + random.randint(-5,5)
			self.maxHealth = self.health
			self.armour = 3
			self.damage = (8 + self.level) + random.randint(-2,2)
			self.evasion = (0) + random.randint(0,2)
			self.accuracy = (100) + random.randint(-10,-1)